<!-- 待审核 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">待审核</p>
    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :formJson="formJson"
      :hidebj="true"
      :qx="qx"
      ref="databale"
    ></dxtable>
    <n-modal v-model:show="showModal" preset="card" class="dfdsrtyrytyt">
      <template #header>
        <div>审核</div>
      </template>
      <div>
        <n-radio-group v-model:value="shjjseft" name="radiogroup">
          <n-space>
            <n-radio
              v-for="song in songs"
              :key="song.value"
              :value="song.value"
            >
              {{ song.label }}
            </n-radio>
          </n-space>
        </n-radio-group>
        <div class="mt20" v-if="shjjseft == '3'">
          <n-input
            v-model:value="shhehsdrt"
            type="textarea"
            placeholder="请输入驳回的原因"
          />
        </div>
      </div>
      <template #action>
        <div class="tr">
          <n-button type="primary" @click="shenhedtyt" :loading="hjshsd"> 确认审核 </n-button>
          <n-button class="ml20" @click="showModal=false"> 关闭 </n-button>
        </div>
      </template>
    </n-modal>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost } from "../../util/index";
import { NButton, NImage, NTag } from "naive-ui";
import { h, ref, reactive } from "vue";
const databale = ref();
const showModal = ref(false);
const rowData = ref({})
const shhehsdrt = ref();
const hjshsd = ref()
const jhdfdgg =async()=>{
  const {data}:any = await dxget("jyc/api/tixinasfr",{stat:1})
  let jsdfsdf = data
  if(data==null){
    jsdfsdf = 0
  }
  dataJson[1].title = '申请金额('+jsdfsdf+')'
}
jhdfdgg()
const initeer = () => {
  databale.value.initDataExpose();
  jhdfdgg()
};
const shjjseft = ref("1");
const songs = [
  {
    label: "审核中",
    value: "1",
  },
  {
    label: "通过",
    value: "2",
  },
  {
    label: "驳回",
    value: "3",
  },
];
let dataJson = [
  {
    title: "申请人",
    key: "userName",
    width: 120,
  },
  {
    title: "申请金额",
    key: "jiner",
  },
  {
    title: "电话",
    key: "phone",
  },
  {
    title: "身份证号码",
    key: "idCard",
  },
  {
    title: "提现卡号",
    key: "shoukuanzh",
  },
  {
    title: "申请时间",
    key: "addTime",
    width: 150,
  },
  {
    title: "操作",
    render(row) {
      return h(
        NButton,
        {
          dxdata: row,
          quaternary: true,
          type: "info",
          onClick: function (data) {
            shhehsdrt.value  =""
            rowData.value = row
            showModal.value= true
          },
        },
        "审核"
      );
    },
  },
];

const qx = {
  DeletePermissionID: "234567", //删除
  EditPermissionIdentifier: "234567", // 编辑
  NewPermissionIdentifier: "234567", // 新建
  ViewPermissionID: "234567", // 查看
};
const portUrl = "jyc/tixianjl/tixianjl?stat=1";

let formJson = reactive([]);
// 审核
const shenhedtyt = async()=>{
    hjshsd.value= true
    const obj = {
        id:rowData.value.id,
        stat:shjjseft.value
    }
    if(shjjseft.value=='3'){
        obj.beizhu = shhehsdrt.value
    }
    const {data}:any = await dxpost("jyc/tixianjl/tixianjl",obj,"put")
    if(shjjseft.value=='2'){
        await dxpost("jyc/jycadmin/ptjiansdd",{
        id:rowData.value.uid,
        leixing:2,
        jiner:rowData.value.jiner,
        beizhu:"提现",
        czlx:"提现",
        type:1
      })
    }
    showModal.value = false
    hjshsd.value = false
    initeer()

}
// 获取字典内容
// const xtgxxmfl = async () => {
//   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'xtgxxmfl' })
//   dataJson[2].options = [
//     {
//       label: "全部",
//       value: ""
//     },
//     ...data
//   ]
//   formJson[2].options = data
//   xmlxSelect.value = data
//   console.log(data);
// }
// xtgxxmfl()
</script>
<style scoped></style>
<style>

</style>
